import React, { useState } from 'react';
import {
  MenuFoldOutlined,
  MenuUnfoldOutlined,
  UploadOutlined,
  UserOutlined,
  VideoCameraOutlined,
} from '@ant-design/icons';
import { Button, Layout, Menu, theme } from 'antd';
import { useNavigate ,Routes,Route,Outlet } from "react-router-dom"
import xiaoshouchuku from './xiaoshouguanli/Xiaoshouchuku'
import xiaoshoudingdan from './xiaoshouguanli/Xiaoshoudingdan'
const { Header, Sider, Content } = Layout;

const Home = () => {
  const [collapsed, setCollapsed] = useState(false);
  const {
    token: { colorBgContainer, borderRadiusLG },
  } = theme.useToken();

const nav = useNavigate()

  return (
    <Layout>
      <Sider trigger={null} collapsible collapsed={collapsed}>
        <div className="demo-logo-vertical" />
        <Menu
          theme="dark"
          mode="inline"
          
          onSelect={(obj)=>{
              nav(obj.key)
          }}
        
          items={[
            {
              key: '/xiaoshouguanli',
              icon: <UserOutlined />,
              label: '销售管理',
              children:[
                {
                  key: '/xiaoshouguanli/xiaoshoudingdan',
                  label: '销售订单',
                },
                {
                  key: '/xiaoshouguanli/xiaoshouchuku',
                  label: '销售出库',
                }
              ]
            },
           
          ]}
        />
      </Sider>
      <Layout>
        <Header style={{ padding: 0, background: colorBgContainer }}>
          <Button
            type="text"
            icon={collapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}
            onClick={() => setCollapsed(!collapsed)}
            style={{
              fontSize: '16px',
              width: 64,
              height: 64,
            }}
          />
        </Header>
        <Content
          style={{
            margin: '24px 16px',
            padding: 24,
            minHeight: 280,
            background: colorBgContainer,
            borderRadius: borderRadiusLG,
          }}
        >
          <Outlet></Outlet>
        </Content>
      </Layout>
    </Layout>
  );
};

export default Home;